package com.bbcare.switchData.entity.basemodel;

import com.fasterxml.jackson.annotation.JsonFormat;

import org.apache.commons.lang.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;


/**
 * 数据Entity类
 *
 */
public abstract class BaseEntity<T> implements Serializable {

	private static final long serialVersionUID = -2221494740984341426L;

	protected Long id; 				// 主键

	protected String remark; 		// 备注
	protected Long createBy; 		// 创建者

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
	protected Date createDate; 		// 创建日期
	protected String createNameBy;
	protected Long updateBy; 		// 更新者

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
	protected Date updateDate; 		// 更新日期
	protected String updateNameBy;
	protected Integer status; 		// 状态标记（一般用于停用、启用，0：停用；-1：启用）

	private Integer deleted; 		// 逻辑删除标记（0：正常，1：已删除）
	private Integer orderNo; 		// 排序字段
	private String uuid; 			// uuid主键

	private String queryBeginDate; 	// 查询开始日期
	private String queryEndDate; 	// 查询结束日期
	private String groupBy;

	private String ticket;

	protected String additionalSql; //附加的sql语句, 仅限用于拼接特殊的 where 条件
	
	public String getTicket() {
		return ticket;
	}

	public void setTicket(String ticket) {
		this.ticket = ticket;
	}

	// 用于批量删除参数
	protected String ids;

	public BaseEntity() {
		super();
	}




	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Long getCreateBy() {
		return createBy;
	}

	public void setCreateBy(Long createBy) {
		this.createBy = createBy;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Long getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(Long updateBy) {
		this.updateBy = updateBy;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public Integer getDeleted() {
		return deleted;
	}

	public void setDeleted(Integer deleted) {
		this.deleted = deleted;
	}

	public Integer getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(Integer orderNo) {
		this.orderNo = orderNo;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getCreateNameBy() {
		return createNameBy;
	}

	public void setCreateNameBy(String createNameBy) {
		this.createNameBy = createNameBy;
	}

	public String getUpdateNameBy() {
		return updateNameBy;
	}

	public String getQueryBeginDate() {
		return queryBeginDate;
	}

	public void setQueryBeginDate(String queryBeginDate) {
		this.queryBeginDate = queryBeginDate;
	}

	public String getQueryEndDate() {
		return queryEndDate;
	}

	public void setQueryEndDate(String queryEndDate) {
		if(StringUtils.isNotEmpty(queryEndDate)){
			//精确查询结束时间
			if(queryEndDate.indexOf("23:59:59") < 0){
				queryEndDate += " 23:59:59";
			}
			this.queryEndDate = queryEndDate;
		}
	}

	public void setUpdateNameBy(String updateNameBy) {
		this.updateNameBy = updateNameBy;
	}

	public String getGroupBy() {
		return groupBy;
	}

	public void setGroupBy(String groupBy) {
		this.groupBy = groupBy;
	}

	public String getAdditionalSql() {
		return additionalSql;
	}

	public void setAdditionalSql(String additionalSql) {
		this.additionalSql = additionalSql;
	}
}
